﻿function init() {
    canvas = document.getElementById('canvas');
    context = canvas.getContext('2d');
    
    canvas.width = WIDTH;
    canvas.height = HEIGHT;
    
    document.title = 'touhoujs';
    
    graze = 0;
    score = 0;
    
    pause = 0;
    
    enemy = [];
    player_bullet = [];
    enemy_bullet = [];
    
    item_init();
    effect_init();
    image_init();
    player_init();
    story_init();
    document.getElementById('bgm').play();
    
    setInterval(update, 1000 / FPS);
}

function update() {
    if (pause) return;
    story_update();
    effect_update();
    player_update();
    enemy_update();
    bullet_update();
    item_update();

    
    bg_draw();
    effect_draw();
    enemy_draw();
    item_draw();
    player_draw();
    bullet_draw();
}
